<include file="Public/header" title="添加报告 | 企业安全应急响应与缺陷管理中心" banner_selected="dropdown_item-active"/>
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    var ue = UE.getEditor('post-content',{
        toolbars: [
            ['simpleupload','emotion','link','unlink', '|', 'selectall', 'cleardoc'],
        ],
        initialFrameHeight:500,
        zIndex:100
    });
</script>
 <div class="container container-report">
        <div>
            <div class="section section-mobile">
                <div class="section_mobile">
                    <div class="mobile_header">
                        <div class="header_title">
                        </div>
                    </div>

					<form method="post" action="{:U('post/add')}">
                    <div class="mobile_content">
                        <div class="mod-form-block mod-form-block-input mod-form-block-input-name">
                            <label class="label-required" for="">漏洞名称</label>
                            <div>
                                <div>
                                     <input name="title" type="text" placeholder="请输入漏洞名称">
                                </div>
                                <div class="formtips-error">
                                    <span>您输入的漏洞名称有误，请重新输入</span>
                                </div>
                            </div>
                        </div>
                        <div class="mod-form-block mod-form-block-select mod-form-block-select-type">
                            <label class="label-required" for="">漏洞类型</label>
                            <div>
                                <div>
                                    <div>
                                        <select class="type_select-2" name="" id="">
                                            <foreach name="category" item="v">
													<option value="{$v.id}">{$v.html} {$v.title}</option>
											</foreach>
                                        </select>
                                        <div class="shape-triangle"></div>
                                    </div>
                                </div>
                                <div class="formtips-error">
                                    <span>请您选择漏洞类型</span>
                                </div>
                            </div>
                        </div>
                        <div class="mod-form-block mod-form-block-textarea mod-form-block-textarea-description">
                            <label class="label-required" for="">漏洞描述</label>
                            <div>
                                <div>
                                    <script id="post-content" name="content" type="text/plain" style="width:100%"></script>
                                </div>
                                <div class="formtips-error">
                                    <span>您输入的漏洞描述有误，请重新输入</span>
                                </div>
                        </div>
						<div class="mod-form-block mod-form-block-file">
                                    <label for="">上传附件</label>
                                    <div>
                                        <div>
                                            <a href="javascript:;" class="uploader mod-btn mod-btn-black">
                                                <input id="attachment_file" type="file" name="attachment" onchange="submit_attachment();"/>
												<input id="attachment_path" type="hidden" name="attachment" />
                                                选择文件
                                            </a>
                                            <span class="tips-file">* 格式限制：doc、docx、7z、zip、pdf，请上传小于5M的文件</span>
                                        </div>
                                        <span id="upload_fail" class="formtips-error">上传失败，请检查文件格式和大小</span>
                                    </div>
                        </div>

                        <div class="mod-form-block mod-form-block-verify">
                            <label class="label-required" for="">验证码</label>
                            <div>
                                <div>
                                    <input name="verify" type="text">
                                    <img id="captcha_img" class="verify" src="{:U('login/verify')}" alt="点击刷新"/>
                                    <a onclick="refresh_captcha();">换一张</a>
                                </div>
                                <div class="formtips-error">
                                    <span>您输入的验证码有误，请重新输入</span>
                                </div>
                            </div>
                        </div>
                        <div class="mod-form-block mod-form-block-submit">
                            <div>
                                <p class="tips-submit">在漏洞未修复之前，请不要向外界传播</p>
                                <button class="mod-btn mod-btn-blue" type="submit" onclick="document.forms[0].submit();">提交漏洞</button>
                            </div>
                        </div>
					</form>
                    </div>
					</div>
			</div>
        </div>
</div>
<script>
function submit_attachment(){
				//$("#imgWait").show();
                var formData = new FormData();
                formData.append("attachment", document.getElementById("attachment_file").files[0]);   
                $.ajax({
                    url: "__ROOT__/user.php?m=user&c=post&a=attachment_upload",
                    type: "POST",
                    data: formData,
                    contentType: false,
                    processData: false,
                    success: function (data) {
                        if (data.code == "200") {
							$("#attachment_path").attr("value",data.savepath);
                        }else{
							$("#upload_fail").css("display","block");
                        }
                    },
                    error: function () {
						$("#upload_fail").css("display","block");
                    }
                });
}
</script>
<script>
         function refresh_captcha(){
            var src = "{:U('login/verify')}";
            var random = Math.floor(Math.random()*(1000+1));
            $("#captcha_img").attr("src",src+"&random="+random);
        }
</script>
<include file="Public/footer" />